<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","version":"8.3.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"}};
  </script>
<meta name="description" content="字符串的扩展codePointAt()能够正确处理4个字节储存的字符，返回一个字符码点 String.fromCodePoint()用于从码点返回对应字符，但是不能识别32位的UTF-16字符 console.log(String.fromCharCode(0x20BB7));ஷ 不能识别大于0xFFFF的码点，所有最高位2被舍弃，返回的U+0BB7对应的字符，而不是U+20BB7对应的字符 St">
<meta property="og:type" content="article">
<meta property="og:title" content="ES6 学习笔记-String">
<meta property="og:url" content="http://example.com/2021/02/02/ES6/ES6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-String/index.html">
<meta property="og:site_name" content="Lawted&#39;s Blog">
<meta property="og:description" content="字符串的扩展codePointAt()能够正确处理4个字节储存的字符，返回一个字符码点 String.fromCodePoint()用于从码点返回对应字符，但是不能识别32位的UTF-16字符 console.log(String.fromCharCode(0x20BB7));ஷ 不能识别大于0xFFFF的码点，所有最高位2被舍弃，返回的U+0BB7对应的字符，而不是U+20BB7对应的字符 St">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2021-02-02T03:08:22.000Z">
<meta property="article:modified_time" content="2021-05-07T01:28:16.712Z">
<meta property="article:author" content="Lawted Wu">
<meta property="article:tag" content="ES6">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://example.com/2021/02/02/ES6/ES6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-String/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>
<title>ES6 学习笔记-String | Lawted's Blog</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Lawted's Blog</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%9A%84%E6%89%A9%E5%B1%95"><span class="nav-number">1.</span> <span class="nav-text">字符串的扩展</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#codePointAt"><span class="nav-number">1.1.</span> <span class="nav-text">codePointAt()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#String-fromCodePoint"><span class="nav-number">1.2.</span> <span class="nav-text">String.fromCodePoint()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%9A%84%E9%81%8D%E5%8E%86%E5%99%A8%E6%8E%A5%E5%8F%A3"><span class="nav-number">1.3.</span> <span class="nav-text">字符串的遍历器接口</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#At"><span class="nav-number">1.4.</span> <span class="nav-text">At()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#includes-startsWith-endsWith"><span class="nav-number">1.5.</span> <span class="nav-text">includes(),startsWith(),endsWith()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#repeat"><span class="nav-number">1.6.</span> <span class="nav-text">repeat()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#padStart-padEnd"><span class="nav-number">1.7.</span> <span class="nav-text">padStart(),padEnd()</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%A8%A1%E6%9D%BF%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="nav-number">1.8.</span> <span class="nav-text">模板字符串</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%A8%A1%E6%9D%BF%E7%BC%96%E8%AF%91"><span class="nav-number">1.9.</span> <span class="nav-text">模板编译</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%A0%87%E7%AD%BE%E6%A8%A1%E6%9D%BF-tagged-template"><span class="nav-number">1.10.</span> <span class="nav-text">标签模板 (tagged template)</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#String-raw"><span class="nav-number">1.11.</span> <span class="nav-text">String.raw()</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Lawted Wu</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">67</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/LAWTED" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;LAWTED" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



        </div>
      </div>
        <div class="back-to-top animated" role="button" aria-label="Back to top">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="en">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/02/02/ES6/ES6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-String/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Lawted Wu">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Lawted's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          ES6 学习笔记-String
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Posted on</span>

      <time title="Created: 2021-02-02 11:08:22" itemprop="dateCreated datePublished" datetime="2021-02-02T11:08:22+08:00">2021-02-02</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">Edited on</span>
        <time title="Modified: 2021-05-07 09:28:16" itemprop="dateModified" datetime="2021-05-07T09:28:16+08:00">2021-05-07</time>
      </span>

  
    <span class="post-meta-item" title="Views" id="busuanzi_container_page_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">Views: </span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="字符串的扩展"><a href="#字符串的扩展" class="headerlink" title="字符串的扩展"></a>字符串的扩展</h1><h2 id="codePointAt"><a href="#codePointAt" class="headerlink" title="codePointAt()"></a>codePointAt()</h2><p>能够正确处理4个字节储存的字符，返回一个字符码点</p>
<h2 id="String-fromCodePoint"><a href="#String-fromCodePoint" class="headerlink" title="String.fromCodePoint()"></a>String.fromCodePoint()</h2><p>用于从码点返回对应字符，但是不能识别32位的UTF-16字符</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="built_in">String</span>.fromCharCode(<span class="number">0x20BB7</span>));</span><br><span class="line">ஷ</span><br></pre></td></tr></table></figure>
<p>不能识别大于0xFFFF的码点，所有最高位2被舍弃，返回的U+0BB7对应的字符，而不是U+20BB7对应的字符</p>
<p>String.fromCodePoint()方法可以识别0xFFFF的字符串，作用和codePointAt()相反</p>
<h2 id="字符串的遍历器接口"><a href="#字符串的遍历器接口" class="headerlink" title="字符串的遍历器接口"></a>字符串的遍历器接口</h2><p>遍历器的一个优点是可以识别大于0xFFFF的码点，传统的for循环不行</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> text = <span class="built_in">String</span>.fromCodePoint(<span class="number">0x20BB7</span>);</span><br><span class="line"><span class="keyword">for</span>(<span class="keyword">let</span> i <span class="keyword">of</span> text)&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(i);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//&quot;吉&quot;</span></span><br></pre></td></tr></table></figure>


<h2 id="At"><a href="#At" class="headerlink" title="At()"></a>At()</h2><p>返回字符串给定位置的字符，ES7中可以识别编号大于0xFFFF的字符</p>
<h2 id="includes-startsWith-endsWith"><a href="#includes-startsWith-endsWith" class="headerlink" title="includes(),startsWith(),endsWith()"></a>includes(),startsWith(),endsWith()</h2><ul>
<li>includes() : 返回布尔值，表示是否找到了参数字符串</li>
<li>startsWith() : 返回布尔值，表示参数字符串是否在源字符串的头部</li>
<li>endsWith() : 返回布尔值，表示参数字符串是否在源字符串的尾部</li>
</ul>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> s = <span class="string">&#x27;Hello world!&#x27;</span>;</span><br><span class="line"><span class="built_in">console</span>.log(s.startsWith(<span class="string">&#x27;Hello&#x27;</span>));<span class="comment">//true</span></span><br><span class="line"><span class="built_in">console</span>.log(s.endsWith(<span class="string">&#x27;!&#x27;</span>));<span class="comment">//true</span></span><br><span class="line"><span class="built_in">console</span>.log(s.includes(<span class="string">&#x27;o&#x27;</span>));<span class="comment">//true</span></span><br></pre></td></tr></table></figure>
<p>三个方法都支持第二个参数，表示搜索开始的位置</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> s = <span class="string">&#x27;Hello world!&#x27;</span>;</span><br><span class="line"><span class="built_in">console</span>.log(s.startsWith(<span class="string">&#x27;Hello&#x27;</span>,<span class="number">6</span>));<span class="comment">//false</span></span><br><span class="line"><span class="built_in">console</span>.log(s.endsWith(<span class="string">&#x27;!&#x27;</span>,<span class="number">5</span>));<span class="comment">//false</span></span><br><span class="line"><span class="built_in">console</span>.log(s.includes(<span class="string">&#x27;o&#x27;</span>,<span class="number">6</span>));<span class="comment">//true</span></span><br></pre></td></tr></table></figure>
<p>endsWith 表示前n个字符，而其他两个方法针对从第n个位置知道字符串结束</p>
<h2 id="repeat"><a href="#repeat" class="headerlink" title="repeat()"></a>repeat()</h2><p>repeat 方法返回一个新字符串，表示将源字符串重复n次</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;x&#x27;</span>.repeat(<span class="number">3</span>));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;hello&#x27;</span>.repeat(<span class="number">2</span>));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;na&#x27;</span>.repeat(<span class="number">10</span>));</span><br><span class="line"></span><br><span class="line">xxx</span><br><span class="line">hellohello</span><br><span class="line">nananananananananana</span><br></pre></td></tr></table></figure>
<p>参数如果是小数，会被取整</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;x&#x27;</span>.repeat(<span class="number">2.9</span>));</span><br></pre></td></tr></table></figure>
<p>参数如果是负数或者Infinity，会报错</p>
<h2 id="padStart-padEnd"><a href="#padStart-padEnd" class="headerlink" title="padStart(),padEnd()"></a>padStart(),padEnd()</h2><p>ES7具有字符串补全长度的功能，如果某个字符串不够指定长度，会在头部或尾部补全。padStart用于头部补全，padEnd用于尾部补全</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;x&#x27;</span>.padStart(<span class="number">5</span>,<span class="string">&#x27;ab&#x27;</span>));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;x&#x27;</span>.padEnd(<span class="number">4</span>,<span class="string">&#x27;ab&#x27;</span>));</span><br></pre></td></tr></table></figure>
<p>第一个参数用来指定字符串的最小长度，第二个参数是用来补齐的字符串，如果第一个参数等于或者大于指定的最小长度，则返回原字符串，如果没有第二个参数会用空格</p>
<h2 id="模板字符串"><a href="#模板字符串" class="headerlink" title="模板字符串"></a>模板字符串</h2><p>用反引号标识 ` ，可以在字符串中嵌入变量</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//普通字符串</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">`In JavaScript &#x27;\n&#x27; is a line-feed`</span>);</span><br><span class="line"><span class="comment">//多行字符串</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">`string text line 1 </span></span><br><span class="line"><span class="string">string text line 2`</span>);</span><br><span class="line"><span class="comment">//字符串中嵌入变量</span></span><br><span class="line"><span class="keyword">var</span> name = <span class="string">&quot;Bob&quot;</span> , time = <span class="string">&quot;today&quot;</span>;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">`Hello <span class="subst">$&#123;name&#125;</span>,how are you <span class="subst">$&#123;time&#125;</span>?`</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//output:</span></span><br><span class="line">In JavaScript <span class="string">&#x27;</span></span><br><span class="line"><span class="string">&#x27;</span> is a line-feed</span><br><span class="line">string text line <span class="number">1</span></span><br><span class="line">string text line <span class="number">2</span></span><br><span class="line">Hello Bob,how are you today?</span><br></pre></td></tr></table></figure>
<p>如果在模板字符串中需要使用反引号，则前面要用反斜杠转义</p>
<p>模板字符串中嵌入变量，需要将变量名写在${ }之中,而且可以进行运算</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> x = <span class="number">1</span>;</span><br><span class="line"><span class="keyword">var</span> y = <span class="number">2</span>;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">`<span class="subst">$&#123;x&#125;</span>+<span class="subst">$&#123;y&#125;</span> = <span class="subst">$&#123;x+y&#125;</span>`</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//1+2 = 3</span></span><br></pre></td></tr></table></figure>
<p>模板字符串中还可以调用函数</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">fn</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">	<span class="keyword">return</span> <span class="string">&quot;Hello World&quot;</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">`foo <span class="subst">$&#123;fn()&#125;</span> bar`</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//foo Hello World bar</span></span><br></pre></td></tr></table></figure>
<p>如果模板字符串中的变量没有声明，会报错</p>
<h2 id="模板编译"><a href="#模板编译" class="headerlink" title="模板编译"></a>模板编译</h2><p>/(ㄒoㄒ)/~~ 等我学会了正则表达式再来补充！</p>
<h2 id="标签模板-tagged-template"><a href="#标签模板-tagged-template" class="headerlink" title="标签模板 (tagged template)"></a>标签模板 (tagged template)</h2><figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> a = <span class="number">5</span>;</span><br><span class="line"><span class="keyword">var</span> b = <span class="number">10</span>;</span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">tag</span>(<span class="params">s,v1,v2</span>)</span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(s[<span class="number">0</span>]);</span><br><span class="line">  <span class="built_in">console</span>.log(s[<span class="number">1</span>]);</span><br><span class="line">  <span class="built_in">console</span>.log(s[<span class="number">2</span>]);</span><br><span class="line">  <span class="built_in">console</span>.log(v1);</span><br><span class="line">  <span class="built_in">console</span>.log(v2);</span><br><span class="line"></span><br><span class="line">  <span class="keyword">return</span> <span class="string">&quot;ok&quot;</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">console</span>.log(tag <span class="string">`hello <span class="subst">$&#123;a+b&#125;</span> world <span class="subst">$&#123;a*b&#125;</span>`</span>);</span><br></pre></td></tr></table></figure>
<ul>
<li><p>模板标签可以过滤HTML字符串，防止用户输入恶意内容</p>
</li>
<li><p>模板标签可以多语言转换</p>
</li>
<li><p>使用模板标签，在JavaScript中嵌入其他语言</p>
</li>
</ul>
<h2 id="String-raw"><a href="#String-raw" class="headerlink" title="String.raw()"></a>String.raw()</h2><p>String.raw 方法用来充当模板字符串的处理函数，返回一个斜杠都被转义的字符串，对应于替换变量后的模板字符串</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="built_in">String</span>.raw<span class="string">`Hi\n`</span>);</span><br><span class="line">Hi\n <span class="comment">//不会换行</span></span><br></pre></td></tr></table></figure>
    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/ES6/" rel="tag"># ES6</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/02/01/ES6/ES6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-Destructing/" rel="prev" title="ES6 学习笔记 - Destructing">
                  <i class="fa fa-chevron-left"></i> ES6 学习笔记 - Destructing
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/02/04/ES6/ES6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-Numbers/" rel="next" title="ES6 学习笔记-Numbers">
                  ES6 学习笔记-Numbers <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Lawted Wu</span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="Total Visitors">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="Total Views">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>

    </div>
  </footer>

  


  <script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>


<script>
var options = {
  bottom: '64px', // default: '32px'
  right: '32px', // default: '32px'
  left: 'unset', // default: 'unset'
  time: '0.5s', // default: '0.3s'
  mixColor: '#fff', // default: '#fff'
  backgroundColor: '#fff',  // default: '#fff'
  buttonColorDark: '#000',  // default: '#100f2c'
  buttonColorLight: '#fff', // default: '#fff'
  saveInCookies: true, // default: true,
  label: ' ', // default: ''
  autoMatchOsTheme: true // default: true
}
const darkmode = new Darkmode(options);
darkmode.showWidget();
</script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  






  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
